package ui;
import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JRadioButton;
import javax.swing.JButton;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import net.miginfocom.swing.MigLayout;
import javax.swing.JSpinner;
import javax.swing.JComboBox;


public class register extends JFrame {

	private JPanel contentPane;
	private JTextField txtFirstName;
	private JTextField txtLastName;
	private JTextField txtUserName;
	private JTextField txtEmail;
	private JPasswordField passwordField;
	private JButton btnRegister;
	private JButton btnBack;
	private JTextField textField_1;
	private JComboBox comboBox;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					register frame = new register();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public register() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 300, 400);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(new MigLayout("", "[86px,grow][89px][]", "[20px][20px][20px][][][][][][][20px][][][][][23px]"));
		
		txtFirstName = new JTextField();
		txtFirstName.setText("First Name");
		contentPane.add(txtFirstName, "cell 0 0 3 1,growx,aligny top");
		txtFirstName.setColumns(10);
		
		txtLastName = new JTextField();
		txtLastName.setText("Last Name");
		contentPane.add(txtLastName, "cell 0 1 3 1,growx,aligny top");
		txtLastName.setColumns(10);
		
		txtUserName = new JTextField();
		txtUserName.setText("user name");
		contentPane.add(txtUserName, "cell 0 2 3 1,growx,aligny top");
		txtUserName.setColumns(10);
		
		txtEmail = new JTextField();
		txtEmail.setText("email");
		contentPane.add(txtEmail, "cell 0 3 3 1,growx");
		txtEmail.setColumns(10);
		
		passwordField = new JPasswordField("password");
		contentPane.add(passwordField, "cell 0 4 3 1,growx,aligny top");
		
		btnRegister = new JButton("Register");
		btnRegister.addMouseListener(new MouseAdapter() {
			//TODO add user to database
			public void mousePressed(MouseEvent e) {
			}
		});
		String[] questions = {"What was your first animal's name?",
							"What is your hometown?",
							"What is your mother's maiden name?"};
		
		comboBox = new JComboBox(questions);
		contentPane.add(comboBox, "cell 0 5 3 1,growx");
		
		textField_1 = new JTextField("Answer");
		contentPane.add(textField_1, "cell 0 6 3 1,growx");
		textField_1.setColumns(10);
		contentPane.add(btnRegister, "cell 2 7,growx");
		
		btnBack = new JButton("Back");
		btnBack.addMouseListener(new MouseAdapter() {
			@Override
			public void mousePressed(MouseEvent e) {
				login x = new login();
				x.setVisible(true);
				dispose();
			}
		});
		contentPane.add(btnBack, "cell 2 8,growx");
	}

}
